package com.xxmw.transaction.service.app;

import com.baomidou.mybatisplus.core.toolkit.Sequence;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xxmw.transaction.common.entity.P;
import com.xxmw.transaction.model.app.Hedging;
import com.xxmw.transaction.model.brick.BrickOrder;
import com.xxmw.transaction.service.support.Observable;
import com.xxmw.transaction.vo.BrickOrderVo;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 订阅订单服务
 * @author luowenliang
 * @since 2020/2/17 15:52
 */
public interface BrickOrderService extends IService<BrickOrder>, Observable {

     Sequence sequence = new Sequence();

    /**
     * 交易所订单列表
     * @param pageNum
     * @param pageSize
     * @param orderNo
     * @param bourse
     * @return
     */
    P<BrickOrder> pageList (Integer pageNum, Integer pageSize, Long orderNo,
                            Integer bourse, Integer status, String outId, String username, Integer brickId);

    /**
     * 交易所下单接口
     * @param bourseOrder
     */
    void place (BrickOrder bourseOrder);

    /**
     * 查询特定状态的订单
     * @param status
     * @return
     */
    List<BrickOrder> getOrderByStatus (Integer... status);

    /**
     * 预下单
     * @param hedging
     */
    void preOrder(Hedging hedging);

    /**
     * 用户搬砖总收益 含订单总数和总收益
     * @param username
     * @return
     */
    Map<String, String> userTotalProfit (String username, Date start, Date end);

    Page<BrickOrderVo> pageListByUserAndBrickId(Page<BrickOrderVo> page,String username, Long brickId);

    /**
     * 取消订单
     * @param order
     */
    void cancelOrder(BrickOrder order);

    /**
     * 反向对冲
     * @param username
     * @param orderNo
     */
    void orderHedging(String username, Long orderNo);
}
